<!DOCTYPE HTML>
<html lang="{{ .Site.Language.Lang }}" dir="{{ $.Param "contentdir" | default "zh" }}">
<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> 
  <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" />
  <title>{{if .IsHome }} {{ .Site.Title}} {{ else }} {{ .Title }} - {{ .Site.Title }} {{ end }}</title>
  {{ if .Keywords }}
  <meta name="keywords" content="{{ range .Keywords }}{{ . }},{{ end }}">
  {{ else }}
  <meta name="keywords" content="{{ .Site.Params.Keywords }}">
  {{ end }}
  {{ with .Site.Params.AuthorName }}
  <meta name="author" content="{{ . }}">
  {{ end }}
  <meta property="og:title" content="{{ if ne .Permalink " / " }}{{ .Title }}{{else}}{{ .Site.Title }}{{end}}"/>
  <meta property="og:site_name" content="{{ .Site.Title }}">
  <meta property="og:image" content="{{ .Site.BaseURL }}img/author.jpg"> 
  <meta name="title" content="{{ if ne .Permalink " / " }}{{ .Title }} - {{ end }}{{ .Site.Title }}" />
  {{ with .Description }}
  <meta name="description" content="{{ . }}" />
  {{ else }}
  <meta name="description" content="{{ .Site.Params.Description }}">
  {{ end }} 
  <link rel="shortcut icon" href="{{ .Site.BaseURL }}img/favicon.ico" />
  <link rel="apple-touch-icon" href="{{ .Site.BaseURL }}img/apple-touch-icon.png" />
  <link rel="apple-touch-icon-precomposed" href="{{ .Site.BaseURL }}img/apple-touch-icon.png" />
  <link href="//unpkg.com/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
  {{ if .IsPage }}
  <link href="//unpkg.com/imageviewer@1.1.0/dist/viewer.min.css" rel="stylesheet"/>
  {{ end }}
  <link href="{{ .Site.BaseURL }}css/main.css" rel="stylesheet" type="text/css" />
  <link href="{{ .Site.BaseURL }}css/syntax.css" rel="stylesheet" type="text/css" />    
  {{ if isset .Site.Params.Statis "baidusiteid" }}
  <!-- Baidu tongji -->
  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?{{ .Site.Params.Statis.BaiduSiteId }}";
      var s = document.getElementsByTagName("script")[0]; 
      s.parentNode.insertBefore(hm, s);
    })();
  </script>
  <!-- Baidu tongji -->
  {{ end }}
  {{ if isset .Site.Params.Statis "googlesiteid" }}
  <!-- Google Analytics -->
  <script async src="https://www.googletagmanager.com/gtag/js?id={{ .Site.Params.Statis.GoogleSiteId }}"></script>
  <script type="text/javascript">
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());

    gtag('config', '{{ .Site.Params.Statis.GoogleSiteId }} ');
  </script>
  <!-- Google Analytics -->
  {{ end }}
  {{ if isset .Site.Params.Statis "lasiteid" }}
  <!-- 51LaSiteId Analytics -->
  <script charset="UTF-8" id="LA_COLLECT" src="//sdk.51.la/js-sdk-pro.min.js"></script>
  <script>LA.init({id: "{{ .Site.Params.Statis.LaSiteId }}",ck: "{{ .Site.Params.Statis.LaSiteId }}",autoTrack:true})</script>
    </script>
  <!-- 51LaSiteId Analytics -->
  {{ end }}
</head>